package cn.xieyang.gen.database.mysql.impl;

import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import cn.xieyang.gen.database.mysql.ValGenerator;
import cn.xieyang.gen.database.mysql.ValGeneratorConfig;
import lombok.Getter;

@Getter
public class OrdCdeValGeneratorImpl implements ValGenerator {

    private ValGeneratorConfig valGeneratorConfig;

    @Override
    public ValGenerator setValGeneratorConfig(ValGeneratorConfig valGeneratorConfig) {
        this.valGeneratorConfig = valGeneratorConfig;
        return this;
    }

    @Override
    public Integer getVal() {
        Assert.notNull(valGeneratorConfig.getIndex(),"下标不能为空");
        return valGeneratorConfig.getIndex() + 1;
    }

    @Override
    public Boolean isNeedSingleQuotes() {
        return false;
    }

}
